<template>
	<div class="el-full el-box-column">
		<el-card class="box-card el-card-flex">
			<div slot="header" class="clearfix">
				<span>
					<i class="el-icon-warning-outline"></i>
					{{formTitle}}
				</span>
			</div>
			<div class="text item el-over-auto">
				<el-form label-width="300px" ref="addData" :model="addData">
					<el-form-item label="" prop="">
						<el-col :span="18">
							<span style="color:#909399">预定人：{{addData.createdByName}}</span>
							<span style="color:#909399;padding-left:10px">会议室：{{addData.roomName}}</span>
							<span style="color:#909399;padding-left:10px">位置：{{addData.position}}</span>
						</el-col>

					</el-form-item>
					<el-form-item label="会议主题：" prop="meetingSubject" :rules="{ required: true, message: '请填写会议主题'}">
						<el-col :span="12">
							<el-input v-model="addData.meetingSubject" placeholder="请填写会议主题" auto-complete="off"></el-input>
						</el-col>
					</el-form-item>
					<el-form-item label="会议编码：" prop="reservationCode">
						<el-col :span="12">
							<el-input readonly placeholder="会议编码后台自动生成" v-model="addData.reservationCode" auto-complete="off"></el-input>
						</el-col>
					</el-form-item>
					<el-form-item label="会议日期：" required style="margin-bottom: 0;">
						<el-col :span="10" style="width: auto;margin-right: 10px;">
							<el-form-item prop="meetingDate" :rules="{ required: true, message: '请选择会议日期'}">
								<el-date-picker :disabled="addData.auditStatus == 'E'" :clearable="false" v-model="addData.meetingDate" type="date"
								 style="width:180px" placeholder="选择日期" format="yyyy-MM-dd" value-format="yyyy-MM-dd" :picker-options="meetingDatePicker" @change="meetingDataChange">
								</el-date-picker>
							</el-form-item>
						</el-col>
						<el-col :span="10" style="width: auto;">
							<el-form-item prop="startTime" :rules="{ required: true, message: '请选择开始时间'}">
								<el-time-select :disabled="addData.auditStatus == 'E'" :clearable="false" placeholder="开始时间" v-model="addData.startTime"
								 style="width:120px" :picker-options="startTimeOptions()" @change="roomTimeChange">
								</el-time-select>
							</el-form-item>
						</el-col>
						<el-col :span="10" style="width: 25px;text-align: center;">-</el-col>
						<el-col :span="10" style="width: auto;">
							<el-form-item prop="endTime" :rules="{ required: true, message: '请选择结束时间'}">
								<el-time-select :disabled="addData.auditStatus == 'E'" :clearable="false" placeholder="结束时间" v-model="addData.endTime"
								 style="width:120px" :picker-options="endTimeOptions()" @change="roomTimeChange">
								</el-time-select>
							</el-form-item>
						</el-col>

					</el-form-item>
					<el-form-item label="组织内参会人员：" prop="roomAttendees" :rules="{ required: true, message: '请选择参会人员'}">
						<el-col :span="24">
							<el-input v-model="addData.roomAttendees" style="display: none;">
							</el-input>
							<el-tag v-for="tag in addData.roomAttendeesList" :key="tag.attendee" closable size="medium" @close="Close1(tag)">
								{{tag.attendee}}
							</el-tag>
							<el-button plain @click="principalPeople">添加 <i class="el-icon-plus"></i></el-button>
							<el-button plain @click="copyAttendeeEvt">从历史记录选择参会人 <i class="el-icon-copy-document"></i></el-button>
						</el-col>
					</el-form-item>
					<el-form-item label="外部参会人员个数：" prop="foreigners">
						<el-col :span="12">
							<!-- <el-tag v-for="(tag,ind) in addData.foreigners" :key="ind" closable size="medium" @close="removeForeigners(tag)">
								{{tag}}
							</el-tag>
							<el-input ref="addForeignersInput" style="width: 120px;" v-if="foreignersInput" v-model="foreigners"
							 @keyup.enter.native="saveForeigners" @blur="saveForeigners">
							</el-input>
							<el-button v-if="!foreignersInput" size="small" plain @click="addForeigners">添加 <i class="el-icon-plus"></i></el-button> -->
							<el-input-number v-model="addData.foreignNum" width="50%" placeholder="外部人员数量"></el-input-number>
						</el-col>
					</el-form-item>
					<el-form-item label="参会人数：" prop="members">
						<el-col :span="12">
							<el-input-number v-model="addData.members" :min="0" :max="999" maxlength="3" label="请填写人数" ></el-input-number> 人
						</el-col>
					</el-form-item>
					<!-- <el-form-item label="提醒：" prop="notifyIntervalTime">
                <el-col :span="24">
                  <el-radio-group v-model="addData.notifyIntervalTime">
                    <el-radio v-for="(item,k) in notifyIntervalArr" :key="k" :label="item.id" border>{{item.name}}</el-radio>
                  </el-radio-group>
                </el-col>
              </el-form-item> -->
					<!-- <el-form-item label="提醒方式：" prop="notifyMode">
                <el-col :span="24">
                  <el-radio-group v-model="addData.notifyMode">
                    <el-radio v-for="(item,k) in notifyModeArr" :key="k" :label="item.id" border>{{item.name}}</el-radio>

                  </el-radio-group>
                </el-col>
              </el-form-item> -->
					<el-form-item label="内容：" prop="meetingContent" :rules="{ required: true, message: '请填写会议内容'}">
						<el-col :span="12">
							<el-input type="textarea" :rows="4" v-model="addData.meetingContent" placeholder="请填写内容"></el-input>

						</el-col>
					</el-form-item>
					<el-form-item label="附件:">
						<el-col :span="12">

							<el-upload ref="reserUpload" :multiple="true" :limit="10" :auto-upload="false" :action="uploadByBusinessUrl"
							 :data="fileData" :headers="reserUploadHeaders()" :file-list="fileList" :on-change="onChangeFile" :on-success="onSuccess"
							 :on-error="onError" :on-remove="handleRemove" :on-preview="handlePreview">
								<el-button type="primary">选择文件</el-button>
								<div slot="tip" class="el-upload__tip">请上传会议相关文件，如：会议通知、会议资料等，参会人可查看该附件</div>
							</el-upload>
						</el-col>
					</el-form-item>
					<el-form-item label="" prop="" v-if="addData.price">
						<el-col :span="12">

							<div class="priceD" style="border-bottom:none;">
								<span style="color:#666">会议室费用使用标准</span>
								<span style="float:right;color:#666">{{addData.price}}元/小时</span>
							</div>
							<div class="priceD" style="border-bottom:none;border-top:none;">
								<span style="color:#666">会议时长</span>
								<span style="float:right;color:#666">{{addData.duration}}小时</span>
							</div>
							<div class="priceD">
								<span>预计会议费用</span>
								<span style="float:right;color:red">￥{{addData.cost}}</span>
							</div>
						</el-col>
					</el-form-item>

					<!-- <el-form-item label="" prop="" v-if="addData.price">
                <el-col :span="8">

                </el-col>
              </el-form-item>
              <el-form-item label="" prop="" v-if="addData.price">
                <el-col :span="8">

                </el-col> -->
					<!-- </el-form-item> -->
					<el-form-item label="" prop="" v-if="addData.auditStatusDesc">
						<el-col :span="12">
							<el-input type="textarea" :rows="4" v-model="addData.content" placeholder="请填写内容"></el-input>
							<el-button type="danger" style="display:block;float:right;margin-top:8px" @click="handleCheckContent('addData')">回
								复 <i class="el-icon-document-checked"></i></el-button>
						</el-col>
					</el-form-item>
					<el-form-item label="" prop="" v-if="addData.auditStatusDesc">
						<el-col :span="12">
							<div class="text item el-over-auto">
								<ul class="text mid-panels">
									<li class="el-box panel" v-for="(val, index) in addData.roomCommentList" :key="index">
										<div class="user-avatar">{{val.attendee}}</div>
										<div class="listRightPart">
											<span class="name">{{val.attendee}}</span>
											<span class="dept">{{val.content}}</span>
											<p>{{val.creationDate}}<span style="float:right;color:#909399" @click="handDelete(val)">删除</span></p>
											<!-- <p>11-12</p> -->
											<!-- <span class="dept" v-for="(v, i) in val.positions" :key="i">{{v.posiName}}</span> -->

											<!-- <p>{{val.creationDate}}</p> -->
										</div>

									</li>
								</ul>
							</div>
						</el-col>
					</el-form-item>
				</el-form>
			</div>
			<div style="text-align: right;margin-bottom: 8px;margin-right: 8px;">
				<el-button type="" @click="handleCheckAdd('addData')">保 存 <i class="el-icon-document-checked"></i></el-button>
				<el-button type="primary" @click="handleCheckput('addData')" v-if="isput">提 交 <i class="el-icon-document-checked"></i></el-button>
				<el-button type="danger" @click="cancelEvt()">关 闭 <i class="el-icon-close"></i></el-button>
			</div>
		</el-card>
		<selectPersonnelDalog :schedulePersonList="addData.roomAttendeesList" :dialogPersonnelVisible="dialogprincipalVisible"
		 :multiple="true" @dialogEmployeesData="dialogprincipalCheckSure" />
		<selectOrg :dialogPersonnelVisible="dialogOrgVisible" :multiple="true" @dialogEmployeesData="dialogOrgCheckSure"></selectOrg>

		<!-- 复制参会人员弹窗 -->
		<el-dialog title="复制参会人员" :visible.sync="attendeeDialogVisible" :close-on-click-modal="false" :close-on-press-escape="false">
			<el-table :data="myMeetingData" border style="width: 100%" :highlight-current-row="true" @current-change="myMeetingTableCurrentChange">
				<el-table-column min-width="100px" sortable :show-overflow-tooltip="true" label="会议主题">
					<template slot-scope="scope">
						<div class="agentName" @click="handleAgentName(scope.$index,scope.row)">
							<span>{{scope.row.meetingSubject}}</span>
						</div>
					</template>
				</el-table-column>
				<el-table-column min-width="100px" sortable :show-overflow-tooltip="true" prop="roomName" label="会议室名称"></el-table-column>
				<el-table-column min-width="100px" sortable :show-overflow-tooltip="true" prop="members" label="人数" align="right"></el-table-column>
				<el-table-column min-width="120px" sortable :show-overflow-tooltip="true" prop="" label="开始时间" align="center">
					<template slot-scope="scope">
						<span>{{scope.row.meetingDate}}</span>
						<span>{{scope.row.startTime}}</span>
					</template>
				</el-table-column>
				<el-table-column min-width="120px" sortable :show-overflow-tooltip="true" prop="" label="结束时间" align="center">
					<template slot-scope="scope">
						<span>{{scope.row.meetingDate}}</span>
						<span>{{scope.row.endTime}}</span>
					</template>
				</el-table-column>
				<el-table-column min-width="120px" sortable :show-overflow-tooltip="true" prop="" label="状态" align="center">
					<template slot-scope="scope">
						{{scope.row.auditStatusDesc}}-{{scope.row.currentStatus}}
					</template>
				</el-table-column>
			</el-table>
			<div slot="footer" class="dialog-footer">
				<el-button type="primary" @click="copyAttendee">
					确定
					<i class="el-icon-document-checked el-icon--right"></i>
				</el-button>
				<el-button @click="attendeeDialogVisible = false">
					取消
					<i class="el-icon-refresh-left"></i>
				</el-button>
			</div>
		</el-dialog>

	</div>
</template>
<script>
import {
  Dialog,
  Table,
  TableColumn,
  Pagination,
  MessageBox,
  Message,
  Drawer,
  Tabs,
  TabPane,
  Upload
} from 'element-ui'
import {
  attachPath, // 附件绝对地址
  uploadByBusinessUrl, // 上传接口
  findAttchList, // 获取文件列表
  preview, // 预览图片
  deleteAttid, // 附件删除
  downloadAttach // 附件下载
} from '@/api/attachCommon/attachCommon.js'
import {
  getCookie // 获取cookie
} from '@/api/layout/layout.js'

import {
  addReservation, // 保存会议室预定
  upReservation, // 修改会议室预定
  putReservation, // 提交会议室预定
  getReservation, // 获取会议室详情
  childrenDict // 会议提醒间隔
  // 获取会议预定编码
} from '@/api/conference/reservation.js'
import {
  delComment, // 删除会议评论
  addComment, // 新增会议评论
  commentList, // 查询会议评论
  createList, // 我发起的列表
  joinList, // 我参与的
  putAttendeeIdattendee, // 参加或者不参加会议处理
  putCancel // 取消会议
} from '@/api/conference/conferenceEmploy.js'

import {
  nextval // 获取编码规则
} from '@/api/conference/conferenceManage.js'
import selectPersonnelDalog from '@/components/selectPersonnel'
import selectOrg from '../selectOrg'
import {
  getTime
} from '@/api/conference/Initialize.js'
export default {
  name: 'creatColumn',
  components: {
    'el-dialog': Dialog, // 对话框
    'el-table': Table, // 表格
    'el-table-column': TableColumn, // 表格列
    'el-pagination': Pagination, // 分页
    'el-drawer': Drawer, // 抽屉
    'el-tabs': Tabs, // 标签页
    'el-tab-pane': TabPane, // 标签页列
    'el-upload': Upload, // 上传
    selectPersonnelDalog,
    selectOrg
    //   dialogConferenceType,
    //   dialogConferenceAddr
    //   drawerTree
  },
  data () {
    return {
      meetingDatePicker: {
        disabledDate: time => {
          return (
            time.getTime() < new Date().getTime() - 8.64e7 // 加- 8.64e7则表示包当天
          )
        }
      },
      intervalTimes: {}, // 预定时间设置
      myMeetingCurrentRow: {},
      myMeetingData: [], // 我的会议表格数据源
      attendeeDialogVisible: false, // 复制参会人员对话框是否开启
      uploadByBusinessUrl: uploadByBusinessUrl, // 附件上传接口
      foreignersInput: false, // 添加外部人员的输入框是否显示
      foreigners: '', // 外部参会人员存储
      elDialogTreeKey: 3,
      imageUrl: '',
      getFile: {},
      headingId: '',
      fileData: {
        sysCode: getCookie('sysCode'), // 系统编码
        bigCatName: '会议',
        smallCatName: '附件',
        businessId: ''
      },
      addData: {
        reservationId: '',
        reservationCode: '',
        createdByName: '',
        roomName: '',
        name3: '',
        meetingSubject: '',
        meetingDate: '',
        startTime: '',
        endTime: '',
        members: '0',
        notifyMode: 'ec8304ebc583447ebdb816e17b3c0c4b',
        notifyIntervalTime: '85ae0f27647d4ad182e88b4d8c547998',
        meetingContent: '',
        roomCommentList: [],
        content: '',
        roomAttendeesList: [],
        roomAttendees: '',
        duration: '',
        cost: '',
        foreignNum: 0,
        foreigners: [] // 外部参会人员

      },
      roomAttendeesList: [],
      duration: '',
      cost: '',
      articleTemplateList: [], // 栏目内容下拉
      addStatus: [], // 栏目模板
      isShow: false,
      fileList: [],
      formTitle: '预定会议室',
      imgAttid: '',
      dialogImageUrl: '',
      dialogVisible: false,
      dialogprincipalVisible: false, // 选择人员
      dialogOrgVisible: false, // 选择组织
      dialogGroupVisible: false, // 选择会议类型
      dialogAddrVisible: false, // 选择位置
      notifyIntervalArr: [], // 提醒时间
      notifyModeArr: [], // 提醒方式
      isDis: false,
      isput: false,
      meetingDate: new Date(),
      startTime: '',
      endTime: '',
      reservationCode: ''
      // employeesPeople:[
      //     {
      //         attendee: '张一',
      //         content: '你说什么'
      //     }
      // ]

    }
  },
  created () {
    getTime().then((res) => {
      if (res.data.code == 10000) {
        this.intervalTimes = res.data.data // 预定时间设置
      }
    })
    this.formTitle = '预定会议室'
    childrenDict('cbc72d21118b4051aebd664dd42e9e80').then((res) => {
      if (res.data.code == 10000) {
        this.notifyIntervalArr = res.data.data
      }
    })
    childrenDict('db1989306b964c5c9444381b32db8cb9').then((res) => {
      if (res.data.code == 10000) {
        this.notifyModeArr = res.data.data
      }
    })
    if (this.$route.params.row.auditStatusDesc) {
      this.authorizationTabel(this.$route.params.row.reservationId)
    } else {
      Object.assign(this.addData, this.$route.params.row)
      if (!this.addData.foreigners) {
        this.addData.foreigners = []
      } else if (!Array.isArray(this.addData.foreigners)) {
        this.addData.foreigners = this.addData.foreigners.split(',')
      }
      this.roomTimeChange() // 设置会议时长和费用
      this.addData.position = this.addData.positionName
      this.isput = true
      nextval('CCIT_RESERVATION_CODE', []).then((res) => {
        if (res.data.code == 10000) {
          this.addData.reservationCode = res.data.data
        }
      })
      this.axios.get('/home/loginUser').then(res => {
        if (res.data.code != 10000) return
        this.addData.createdByName = res.data.data.empName
      })
    }
  },
  /* 监听对象变化 */
  watch: {
    /* 监听参会人员 ,用作校验特殊处理 */
    'addData.roomAttendeesList': {
      handler (newValue, oldValue) {
        console.log('length:' + newValue.length)
        if (newValue.length) {
          this.addData.members = newValue.length + this.addData.foreignNum
          this.addData.roomAttendees = ' '
        } else {
          this.addData.roomAttendees = ''
          this.addData.members = 0 + this.addData.foreignNum
        }
      }
    },
    'addData.foreignNum': {
      handler (newValue, oldValue) {
        this.addData.members = newValue + this.addData.roomAttendeesList.length
        console.log('this.addData.members:' + this.addData.members)
        console.log('this.addData.foreignNum:' + this.addData.foreignNum)
        console.log('this.addData.roomAttendeesList.length:' + newValue)
        console.log('newValue:' + newValue)
      }
    }
  },
  methods: {
    /* 获取当前系统日期 */
    getDate (num) {
      if (!num) {
        num = 0
      }
      let objDate = new Date()
      objDate.setDate(objDate.getDate() + num) // 加天数
      let month = objDate.getMonth() + 1
      if (month < 10) {
        month = '0' + month
      }
      let day = objDate.getDate()
      if (day < 10) {
        day = '0' + day
      }
      let strDate = objDate.getFullYear() + '-' + month + '-' + day
      return strDate
    },
    /* 开始时间校验 */
    startTimeOptions () {
      let opt = {
        start: this.intervalTimes.startTime,
        step: '0' + this.intervalTimes.intervalTime + ':00',
        end: this.intervalTimes.endTime,
        maxTime: this.addData.endTime
      }
      if (this.addData.meetingDate == this.getDate()) { // 如果是今天，则控制最小时间
        let hours = new Date().getHours() // 当前小时
        if (hours < 10) {
          hours = '0' + hours
        }
        hours += ':00'
        opt.minTime = hours
      } else {
        opt.minTime = ''
      }
      return opt
    },
    /* 结束时间校验 */
    endTimeOptions () {
      let opt = {
        start: this.intervalTimes.startTime,
        step: '0' + this.intervalTimes.intervalTime + ':00',
        end: this.intervalTimes.endTime,
        minTime: this.addData.startTime
      }
      return opt
    },
    /* 设置上传附件的请求头（认证信息） */
    reserUploadHeaders () {
      return {
        Authorization: getCookie('Authorization') // 认证信息
      }
    },
    /* 附件队列改变事件 */
    onChangeFile (file, fileList) {
      this.fileList = fileList
    },
    /* 附件上传成功 */
    onSuccess (res) {
      if (res.code === 10000) {
        if (this.uploadMsg) {
          this.uploadMsg.close()
        }
        this.uploadMsg = Message.success('操作成功')
        this.$router.go(-1)
        // this.$router.push(this.routerMatch({
        // 	path: '/reservation'
        // }))
      } else {
        Message.error(res.msg)
      }
    },
    /* 文件上传(提交)接口失败 */
    onError (err) {
      Message.error('上传失败')
    },
    /* 文件移除 */
    handleRemove (file) {
      if (file.attId) {
        deleteAttid(file.attId) // 删除附件
      }
    },
    /* 附件下载 */
    handlePreview (file) {
      downloadAttach(file.attId)
    },
    /* 外部人员添加按钮事件 */
    addForeigners () {
      this.foreignersInput = true
      this.$nextTick(_ => {
        this.$refs.addForeignersInput.$refs.input.focus()
      })
    },
    saveForeigners () {
      if (this.foreigners) {
        this.addData.foreigners.push(this.foreigners)
      }
      this.foreignersInput = false
      this.foreigners = ''
    },
    removeForeigners (tag) {
      this.addData.foreigners.splice(this.addData.foreigners.indexOf(tag), 1)
    },
    // 关闭
    cancelEvt () {
      this.$router.go(-1)
      // this.$router.push(this.routerMatch({
      // 	path: '/reservation'
      // }))
    },
    // 编辑表格获取单条数据事件
    authorizationTabel (id) {
      getReservation(id, '2').then(res => {
        if (res.data.code == 10000) {
          Object.assign(this.addData, this.$route.params.row)
          if (!this.addData.foreigners) {
            this.addData.foreigners = []
          } else if (!Array.isArray(this.addData.foreigners)) {
            this.addData.foreigners = this.addData.foreigners.split(',')
          }
          if (this.addData.auditStatus == 'E' && this.addData.currentStatus == '未开始') {
            this.isDis = true
          } else {
            this.isDis = false
          }
          if ((this.addData.auditStatus == 'A') && this.addData.currentStatus == '未开始') {
            this.isput = true
          } else {
            this.isput = false
          }
        }
        this.roomTimeChange() // 设置会议时长和费用
        // 获取附件
        findAttchList({
          businessId: id
        }).then((res) => {
          if (res.data.code == 10000) {
            if (res.data.data.records !== []) {
              let atts = res.data.data.records
              this.fileList.splice(0, this.fileList.length)
              atts.forEach((v) => {
                this.fileList.push({
                  name: v.attFullName,
                  url: attachPath + v.attRefId,
                  attId: v.attId
                })
              })
            }
          }
        })
      })
    },
    meetingDataChange () {
      this.addData.startTime = ''
      this.addData.endTime = ''
    },
    /* 设置会议时长和费用 */
    roomTimeChange () {
      if (!this.addData.startTime || !this.addData.endTime) return
      let date1 = new Date(this.addData.meetingDate + ' ' + this.addData.startTime)
      let date2 = new Date(this.addData.meetingDate + ' ' + this.addData.endTime)
      this.addData.duration = (date2.getTime() - date1.getTime()) / 3600000
      this.addData.cost = this.addData.price * this.addData.duration
    },
    /* 保存成功的回调 */
    saveCallback (res) {
      if (res.data.code == 10000) {
        for (let i = 0, len = this.fileList.length; i < len; i++) {
          if (!this.fileList[i].attId) { // 如果有需要上传的附件
            this.fileData.businessId = res.data.data
            this.$refs.reserUpload.submit() // 手动触发上传
            return false
          }
        }
        Message({
          type: 'success',
          message: '保存成功'
        })
        this.$router.go(-1)
        // this.$router.push(this.routerMatch({
        // 	path: '/reservation'
        // }))
      }
    },
    /* 保存 */
    /* 提取请求参数 */
    extractDatas () {
      let sendDatas = {
        meetingSubject: this.addData.meetingSubject,
        meetingDate: this.addData.meetingDate,
        startTime: this.addData.startTime,
        endTime: this.addData.endTime,
        members: this.addData.members,
        notifyMode: this.addData.notifyMode,
        notifyIntervalTime: this.addData.notifyIntervalTime,
        meetingContent: this.addData.meetingContent,
        roomId: this.addData.roomId,
        roomAttendeesList: this.addData.roomAttendeesList,
        reservationCode: this.addData.reservationCode,
        foreignNum: this.addData.foreignNum,
        foreigners: this.addData.foreigners.join(',') // 外部参会人员
      }
      if (this.addData.reservationId) {
        sendDatas.reservationId = this.addData.reservationId
      }
      return sendDatas
    },
    handleCheckAdd (formName) {
      this.$refs[formName].validate((valid) => {
        if (!valid) return // 校验
        if (!this.addData.reservationId) {
          addReservation(this.extractDatas()).then(this.saveCallback)
        } else {
          upReservation(this.extractDatas()).then(this.saveCallback)
        }
      })
    },
    // 提交
    handleCheckput (formName) {
      this.$refs[formName].validate((valid) => {
        if (!valid) return // 校验
        putReservation(this.extractDatas()).then(this.saveCallback)
      })
    },
    // 获取会议评论
    getComment () {
      commentList(this.addData.reservationId).then((res) => {
        if (res.data.code == 10000) {
          this.addData.roomCommentList = res.data.data
        }
      })
    },
    // 新增评论
    handleCheckContent () {
      if (!this.addData.content) {
        Message.warning('请输入评论内容')
        return
      }
      addComment({
        content: this.addData.content,
        reservationId: this.addData.reservationId
      }).then((res) => {
        if (res.data.code == 10000) {
          Message.success('评论成功')
          this.getComment()
          this.addData.content = ''
        }
      })
    },
    // 删除会议评论
    handDelete (v) {
      //
      MessageBox.confirm('是否确定删除评论?', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
      })
        .then(() => {
          delComment(v.commentId).then(res => {
            if (res.data.code === 10000) {
              Message.success('删除成功')
              this.getComment()
              // this.myDelegateTable()
            }
          })
        })
        .catch(() => {})
    },
    // 人员弹框
    principalPeople () {
      this.dialogprincipalVisible = true
      if (this.addData.roomAttendeesList) {
        this.addData.roomAttendeesList.forEach((v) => {
          v.personName = v.attendee
          v.userId = v.attendeeUserId
          v.empName = v.attendee
        })
        this.roomAttendeesList = this.addData.roomAttendeesList
      }
    },
    // 复制参会人员
    copyAttendeeEvt () {
      this.attendeeDialogVisible = true
      joinList({
        value: {}
      }).then(res => {
        this.myMeetingData = res.data.data.records
      })
    },
    /* 单选点击事件 */
    myMeetingTableCurrentChange (row) {
      this.myMeetingCurrentRow = row
    },
    // 复制参会人员
    copyAttendee () {
      if (!this.myMeetingCurrentRow || !this.myMeetingCurrentRow.roomAttendeesList || !this.myMeetingCurrentRow.roomAttendeesList
        .length) {
        Message.warning('请选择要复制参会人员的会议！')
        return
      }
      this.myMeetingCurrentRow.roomAttendeesList.forEach(v => {
        let isReady
        this.addData.roomAttendeesList.forEach(e => {
          if (e.attendeeUserId == v.attendeeUserId) {
            isReady = true
          }
        })
        if (!isReady) {
          this.addData.roomAttendeesList.push(v)
        }
      })
      this.attendeeDialogVisible = false
    },
    dialogprincipalCheckSure (data) {
      this.dialogprincipalVisible = false
      if (!data) {
        return
      }
      let name = []
      this.addData.roomAttendeesList = data
      this.addData.roomAttendeesList.forEach((v) => {
        v.attendee = v.empName
        if (!v.attendeeUserId) {
          v.attendeeUserId = v.userId
        }
        v.name = v.empName
        v.id = v.userId
        name.push(v.empName)
      })
      this.addData.roomAttendees = name.join(',')
      this.roomAttendeesList = this.addData.roomAttendeesList
      // this.formData.waiterList = data[0].empName
      // this.formData.waiter = data[0].userId
    },
    Close1 (tag) {
      for (let i = 0, len = this.addData.roomAttendeesList.length; i < len; i++) {
        if (tag.attendeeUserId == this.addData.roomAttendeesList[i].attendeeUserId) {
          this.addData.roomAttendeesList.splice(i, 1)
          return false
        }
      }
    },
    clearParentName () {
      // this.addData.positionId = ''
      // this.addData.positionName = ''
      this.formData.waiterList = []
      this.formData.waiter = ''
    },
    // 组织弹框
    principalOrg () {
      this.dialogOrgVisible = true
    },
    dialogOrgCheckSure (data) {
      this.dialogOrgVisible = false
      if (!data) {

      }
    },
    clearOrgName () {
      this.formData.orgRangeList = []
      this.formData.orgRange = ''
      // this.addData.positionId = ''
      // this.addData.positionName = ''
    },
    // 会议类型
    dialogClick () {
      this.dialogGroupVisible = true
    },
    dialogTypeCheckSure (data) {
      this.dialogGroupVisible = false
      if (!data) {

      }
    },
    clearTypeName () {
      this.formData.roomCatId = ''
      this.formData.roomCatName = ''
      // this.addData.positionId = ''
      // this.addData.positionName = ''
    },
    // 位置
    dialogClickAddr () {
      this.dialogAddrVisible = true
    },
    dialogAddrCheckSure (data) {
      this.dialogAddrVisible = false
      this.dialogGroupVisible = false
      if (!data) {
        return
      }
      this.addData.positionId = data.positionId
      this.addData.positionName = data.position
    },
    clearAddrName () {
      this.addData.positionId = ''
      this.addData.positionName = ''
    }
  }
}
</script>
<style lang="scss" scoped>
	.avatar-uploader .el-upload {
		border: 1px dashed #d9d9d9;
		border-radius: 6px;
		cursor: pointer;
		position: relative;
		overflow: hidden;
	}

	.avatar-uploader .el-upload:hover {
		border-color: #409EFF;
	}

	.avatar-uploader-icon {
		font-size: 28px;
		color: #8c939d;
		width: 178px;
		height: 178px;
		line-height: 178px;
		text-align: center;
	}

	.avatar {
		width: 178px;
		height: 178px;
		display: block;
	}

	.mid-panels {
		li {
			padding: 15px 10px 7px;
			font-size: 12px;
			color: #333333;
			border-top: 1px solid #ededed;

			// overflow: hidden;
			.user-avatar {
				width: 40px;
				height: 36px;
				text-align: center;
				line-height: 36px;
				border-radius: 50%;
				color: #ffffff;
				background-color: #81C684;
			}

			.listRightPart {
				width: 100% !important;
				display: inline-block;
				padding-left: 10px;
				vertical-align: middle;

				.name {
					display: block;
					overflow: hidden;
					text-overflow: ellipsis;
					white-space: nowrap;
					font-size: 12px;
					color: #333333;
				}

				.dept {
					font-size: 12px;
					color: #333333;
				}
			}

			&:hover {
				cursor: pointer;
				background-color: #fff;
			}
		}

		.loading {
			height: 20px;
			line-height: 20px;
			padding: 0 0 15px 100px;
		}
	}

	.priceD {
		border: 1px solid #ccc;
		padding: 10px;
	}

	.el-tag--medium {
		height: 30px;
		line-height: 28px;
		margin-right: 10px;
		margin-bottom: 10px;
	}

	.el-tag .el-icon-close {
		top: 0 !important;
	}
</style>
